<template>
  <div class="container_detail banner-edit">
    <div class="header">
      <p>广告管理>查看广告</p>
      <el-button class="link" type="primary">
        <router-link :to="{path:'bannerList',query: { pageIndex: currentPage }}" style="color: #fff;">返回</router-link>
      </el-button>
    </div>
    <div class="main">
      <el-form :model="user" :rules="rules" ref="user" label-width="120px" class="">
        <div class="list">
          <div class="title">查看广告</div>
          <el-form-item
            prop="sort"
            >
            <div class="item">
                <div class="item-key">顺序：</div>
                <div class="item-value">
                    {{sort}}
                </div>
            </div>
          </el-form-item>
          <el-form-item
            prop="sort"
            >
            <div class="item">
                <div class="item-key">广告类型：</div>
                <div class="item-value">
                   {{user.type == 'photo'?'图片':'商品'}}
                </div>
            </div>
          </el-form-item>
          <el-form-item
            prop="sort"
            >
            <div class="item">
                <div class="item-key">轮播图：</div>
                <div class="item-value">
                     <img style="width:220px" :src="user.loopPhotos[0].fileUrl" alt="">
                </div>
            </div>
          </el-form-item>
          <el-form-item
            prop="sort"
             v-if="user.type == 'photo'"
            >
            <div class="item">
                <div class="item-key">广告大图：</div>
                <div class="item-value">
                      <img style="width:220px" :src="user.loopPhotos[0].fileUrl" alt="">
                </div>
            </div>
          </el-form-item>
          <el-form-item
            prop="sort"
             v-if="user.type == 'goods'"
            >
            <div class="item">
                <div class="item-key">商品链接：</div>
                <div class="item-value">
                      {{user.goodsCode}}
                </div>
            </div>
          </el-form-item>
          <el-form-item
            prop="sort"
             v-if="user.type == 'goods'"
            >
            <div class="item">
                <div class="item-key">是否展示：</div>
                <div class="item-value">
                       {{user.isOn == 'y'?'是':'否'}}
                </div>
            </div>
          </el-form-item>
        </div>
      </el-form>
    </div>
  </div>
</template>

<script>
let CONSTANT = require("../../constant/constant.js");
let common = require("../../common.js");

export default {
  data() {
    return {
      id: "",
      info: "",
      // 返回 导航页码
      currentPage: 1,
      user: {
        "brandId": "",
        "brandName": "",
        "id": "",
        "psw": "",
        "psw2": "",
        "storeName": "",
        "userName": ""
     },
     sort:''
    };
  },
  mounted() {
    this.sort = this.$router.currentRoute.query.sort;
    this.id = this.$router.currentRoute.query.id;
    this.currentPage = this.$router.currentRoute.query.pageIndex
      ? this.$router.currentRoute.query.pageIndex
      : 1;
    this.getDetail();
  },
  methods: {
     getDetail() {
      let url = CONSTANT.URL.LIST.findEsAdvertiseById;
      let data = { id: this.id }
      common.requestAjax(url, JSON.stringify(data), null, res => {
        this.user = res.data.bussData;
      });
    }
  }
};
</script>
<style lang="scss">
.banner-edit {

  .item-value {
    .el-input {
      width: 50%;
    }
    .el-select {
      width: 50%;
      .el-input {
        width: 100%;
      }
    }
  }
}
</style>

